package com.yuren.codecrushlearn.Q5200;

/**
 * Created with Intellij IDEA.
 * Description:
 * 自定义哈希函数
 * @author Sleepy Code Tom
 * @date 2025-04-18 00:42
 */
public class Q5211 {
    public int hashCode(String str) {
        int sum = 0;
        int power = 1;
        for (int i = str.length() - 1; i >= 0; i--) {
            sum += (str.charAt(i) - 'a') * power;
            power *= 26;
        }
        return sum % 8765;
    }
}
